<HTML>
<HEAD>
<TITLE>
EstrategiaIndice.cpp
</TITLE>
</HEAD>
<BODY>
<PRE>
<font color="blue">#include</font> <font color="maroon">"EstrategiaIndice.h"</font>

<font color="blue">bool</font> EstrategiaIndice<font color="black">:</font><font color="black">:</font>EsIndicePrimario<font color="black">(</font><font color="black">)</font>
<font color="black">{</font>
    <font color="blue">return</font> secondaryKey<font color="black">=</font><font color="black">=</font>NULL;
<font color="black">}</font>



<font color="blue">bool</font> EstrategiaIndice<font color="black">:</font><font color="black">:</font>IndiceSecundarioDeParametro<font color="black">(</font>std<font color="black">:</font><font color="black">:</font>string parametroBuscado<font color="black">)</font>
<font color="black">{</font>
    <font color="blue">if</font><font color="black">(</font>secondaryKey<font color="black">)</font>
        <font color="blue">return</font> secondaryKey<font color="black">-</font><font color="black">&#62;</font>EsIndiceSecundarioQueIndexa<font color="black">(</font>parametroBuscado<font color="black">)</font>;

    <font color="blue">return</font> <font color="blue">false</font>;
<font color="black">}</font>



EstrategiaIndice<font color="black">:</font><font color="black">:</font>~EstrategiaIndice<font color="black">(</font><font color="black">)</font>
<font color="black">{</font>
    <font color="green">//los recursos de las key las deve liberar el usuario</font>
<font color="black">}</font>



EstrategiaIndice<font color="black">:</font><font color="black">:</font>EstrategiaIndice<font color="black">(</font>PrimaryKey <font color="black">*</font>primaryKey<font color="black">)</font> <font color="blue">throw</font><font color="black">(</font>IndexException<font color="black">)</font>
<font color="black">{</font>
    <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>primaryKey<font color="black">=</font>primaryKey;
    <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>secondaryKey<font color="black">=</font>NULL;
    <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>indicePrimario<font color="black">=</font>NULL;
<font color="black">}</font>



EstrategiaIndice<font color="black">:</font><font color="black">:</font>EstrategiaIndice<font color="black">(</font>PrimaryKey <font color="black">*</font>primaryKey, SecondaryKey <font color="black">*</font>secondaryKey, EstrategiaIndice <font color="black">*</font>indicePrimario<font color="black">)</font> <font color="blue">throw</font><font color="black">(</font>IndexException<font color="black">)</font>
<font color="black">{</font>
    <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>primaryKey<font color="black">=</font>primaryKey;
    <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>secondaryKey<font color="black">=</font>secondaryKey;
    <font color="blue">this</font><font color="black">-</font><font color="black">&#62;</font>indicePrimario<font color="black">=</font>indicePrimario;
<font color="black">}</font>

Key<font color="black">*</font> EstrategiaIndice<font color="black">:</font><font color="black">:</font>GetKey<font color="black">(</font><font color="black">)</font>
<font color="black">{</font>
    <font color="blue">if</font><font color="black">(</font>EsIndicePrimario<font color="black">(</font><font color="black">)</font><font color="black">)</font>
        <font color="blue">return</font> primaryKey;
    <font color="blue">return</font> secondaryKey;
<font color="black">}</font>




</PRE>
</BODY>
</HTML>
